﻿<!doctype html>
 <html lang="zh-CN">
 <head>
   <meta charset="UTF-8">
   <link rel="stylesheet" href="../../../css/common.css">
   <link rel="stylesheet" href="../../../css/main.css">
   <script type="text/javascript" src="../../../js/jquery.min.js"></script>
   <script type="text/javascript" src="../../../js/colResizable-1.3.min.js"></script>
   <script type="text/javascript" src="../../../js/common.js"></script>

  <script type="text/javascript">
      //全选
      /*全选方法*/
      $(function(){

          $("#buttonAll").click(function(){
              /*得到点击按钮的状态*/
              /*jq->js*/
              var status=$(this)[0].checked;
              //设置全选
              var cks=document.getElementsByName("menuId");

              for (var i = 0; i < cks.length; i++) {
                  console.log(cks[i])
                  cks[i].checked=status;
              }
          })
      });

      //批量删除
      function deleteAll(){
          confirm("确认删除");
          var name = document.getElementsByName("menuId");
          var sum=0;
          for (var i = 0; i <name.length ; i++) {
              if (name[i].checked==true){
                  sum=1;
                  break;
              }

          }
          if (sum==1) {
              document.getElementById("myMethod").value="deleteAll";
              document.forms[1].submit();
          } else {
              alert("请选择要删除的数据");
          }
      }


      //导出数据
      function excel(){
          confirm("确认导出");
          var name = document.getElementsByName("menuId");
          var sum=0;
          for (var i = 0; i <name.length ; i++) {
              if (name[i].checked==true){
                  sum=1;
                  break;
              }

          }
          if (sum==1) {
              document.getElementById("myMethod").value = "doExcle";
              document.forms[1].submit();
          } else {
              alert("请选择要导出的数据");
          }
      }
  </script>
</head>
<body>
<form action="/resource/system/menu/list" method="post">
     <div id="search_bar" class="mt10">
       <div class="box">
          <div class="box_border">
            <div class="box_top"><b class="pl15">搜索</b></div>
            <div class="box_center pt10 pb10">
              <table class="form_table" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td>菜单名称</td>
                  <td><input type="text" name="menuName" class="input-text lh25" value="${menuName}" size="10"/></td>
                   <td><input type="submit" name="button" class="btn btn82 btn_search" value="查询"/>
			    <input type="reset" name="button" class="btn btn82 btn_recycle" value="清空"/></td>
                </tr>
               
              </table>
            </div>
        
             <div  class="box_bottom pb5 pt5 pr10" style="border-top:1px solid #dadada;">
              <div class="search_bar_btn" style="text-align:center;" >
                 
                 <a href="/resource/system/menu/preAdd" class="ext_btn"><span class="add"></span>添加菜单</a>
              </div>
            </div>
			</div>  </div>
			</form>

 <div id="table" class="mt10">
        <div class="box span10 oh">
              <table width="100%" border="0" cellpadding="0" cellspacing="0" class="list_table">
                <tr>
				   <th> <input id="buttonAll" type="checkbox"></th>
                   <th >菜单名称</th>
                   <th >父菜单</th>
                   <th >路径</th>
				   <th>状态</th>
				   <th>操作</th>
                    </tr>
                  <form action="/resource/system/menu/excleAndDeleteAll?page=${pageInfo.pageNum}&menuName=${menuName}">
                      <input id="myMethod" type="hidden" name="method">
                      <#list pageInfo.list as first>
                          <tr class="tr" align="center">
                              <td class="td_center"><input name="menuId" value="${first.menuId}" type="checkbox"/></td>
                              <td><a href="/resource/system/menu/menuLook?menuId=${first.menuId}">${first.menuName}</a></td>
                              <td>${first.sperMenuName}</td>
                              <td>${first.menuUrl}</td>
                              <td>
                                  <#if (first.menuStatus==0) >
                                      可用
                                  </#if>
                                  <#if (first.menuStatus==1) >
                                      冻结
                                  </#if>
                              </td>
                              <td>
                                  <#if (first.menuStatus==0)>
                                      <a href="/resource/system/menu/status?menuId=${first.menuId}&page=${pageInfo.pageNum}&menuName=${menuName}">禁用</a> |&nbsp;
                                  </#if>
                                  <#if (first.menuStatus==1)>
                                  <a href="/resource/system/menu/active?menuId=${first.menuId}&page=${pageInfo.pageNum}&menuName=${menuName}">启用</a> |&nbsp;
                                  </#if>&nbsp;
                                  <a href="/resource/system/menu/preEdit?menuId=${first.menuId}">编辑</a> |&nbsp;
                                  <a href="/resource/system/menu/delete?menuId=${first.menuId}&page=${pageInfo.pageNum}&menuName=${menuName}" >删除</a>
                              </td>
                          </tr>
                      </#list>
                  </form>
               <tr>
			   <td colspan="2"><input type="button" name="button" class="btn btn82 btn_del" value="删除" onclick="deleteAll()"/>
			    <input type="button" name="button"  class="btn btn82 btn_export" value="导出" onclick="excel()"/>
				</td>
				<td colspan="5" align="right">
				     <div class="page mt10">
						<div class="pagination">
						  <ul >
							  <li class="first-child"><a href="/resource/system/menu/list?page=1&menuName=${menuName}">首页</a></li>
							  <li class=""><a href="/resource/system/menu/list?page=${pageInfo.prePage}&menuName=${menuName}">上一页</a></li>
							  <li><a href="/resource/system/menu/list?page=${pageInfo.nextPage}&menuName=${menuName}">下一页</a></li>
							  <li ><a href="/resource/system/menu/list?page=${pageInfo.pages}&menuName=${menuName}">末页</a></li>
                              <li ><span>第${pageInfo.pageNum}页</span></li>
                              <li ><span>共${pageInfo.total}条数据</span></li>
                              <li ><span>共${pageInfo.pages}页</span></li>
						  </ul>
						</div>
                     </div>
				</td>
			   </tr>
              </table>			  
		
             
        </div>
     </div>

</body>
</html>